<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Base_Controller extends CI_Controller 
{
    public function __construct()
    {
        parent::__construct();

        $this->load->model('userlist_model');

        $alwayAllow = array('login');
        $action = $this->uri->segment(2, '');

        if( ! in_array($action, $alwayAllow) && ! $this->userlist_model->checkLogin())
                redirect('site/login');

        if( ! in_array($action, $alwayAllow))
                $this->load->view('header', $this->session->userdata('user'));
    }
}